
Select table_name from user_tables;
--01
create table books
(
	id int,
	name varchar2(30),
	pub_date date,
	author varchar2(30),
	price number(5,2),
	is_new char(1),
	publisher varchar2(50)
)

--02 table name books exist
Select count(1) from user_tables where regexp_like( lower(table_name) , 'books' ) 

--03 data in books table
select * from books;

--04 id increament

--0401 sequence
create sequence book_id_seq 
increment by 10
start with 1

--0402 show 
Select sequence_name from user_sequences;

--05 dao
--0501 add
insert into BOOKS
(id,name,pub_date,author,price,is_new,publisher)
values
(book_id_seq.nextval,?,?,?,?,?,?)

--0502 getBooks
select         
	bk.id        
	bk.name      
	bk.pub_date  
	bk.author    
	bk.price     
	bk.is_new    
	bk.publisher 
from books bk  

--0503 get
select         
	bk.id        
	bk.name      
	bk.pub_date  
	bk.author    
	bk.price     
	bk.is_new    
	bk.publisher 
from books bk  
where bk.id=?


--0504 update
update books bk
set  
	bk.name=?,
	bk.author=?,
	..
where bk.id=10 

-------------------------------------------------
-- dataClean dropSeq createSeq
delete from BOOKS;
drop sequence book_id_seq;
create sequence book_id_seq 
increment by 1
start with 10;

select count(1) from books;
